package com.esp.soccertutor.ui;

import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;

import com.esp.soccertutor.R;
import com.esp.soccertutor.util.Const;
import com.esp.soccertutor.util.Log;

public class VideoPlayer extends Activity {
	
	
	public String TAG = VideoPlayer.class.getCanonicalName();
	private VideoView mVideoView;
	private String filename;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.videoplayer);
		Const.CONTEXT = VideoPlayer.this;
		mVideoView =(VideoView)findViewById(R.id.videoView);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		filename = getIntent().getStringExtra("filename");
		Log.print(TAG,"[FILE PLAY]" + filename);
		if(!filename.equals(""))
		{
			
			mVideoView.setVideoPath(Const.LIB_DIR+"/" + filename);
			mVideoView.setMediaController(new MediaController(this));
			mVideoView.requestFocus();
			mVideoView.start();
		}
		else
		{
			Toast.makeText(VideoPlayer.this,"No file name found",Toast.LENGTH_LONG);
		}
		
				
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
	}
	
}
